<!--{Atemplate tpl/header}-->

<!--{eval echo $this->Ahtml_js_aurl();}-->
<script>
jQuery(document).ready(function(){
	Acan.form.readys('Asale_stock_list');
});

function checkall(value) {
	if(value=='0'){
		jQuery(".checkbox").attr("checked","checked");
		jQuery("#chkall_del").removeAttr("disabled","disabled");
	}
	if(value=='1'){
		jQuery(".checkbox").removeAttr("checked","checked");
		jQuery("#chkall_del").attr("disabled","disabled");
	}
	if(value=='auth'){
		var chkall = jQuery("input:checked").val();
		if(chkall == null){
			alert('请先选择');
			return false;
		}else{
			return true;
		}
	}
}

jQuery(function(){
	jQuery(".checkbox").change(function (){
		if(jQuery("input:checked").val()){
			jQuery("#chkall_del").removeAttr("disabled","disabled");
		}else{
			jQuery("#chkall_del").attr("disabled","disabled");
		}
	});
})
</script>
<h2>$this->title</h2>
<form method="post">
	产品名称:
	颜色:<input type="text" name="add[color]">
	成本:<input type="text" name="add[cost]">
	价格:<input type="text" name="add[price]">
	数量:<input type="text" name="add[num]">
	<input type="submit" name="submit" value="添加" onClick="javascript:form.action='$this->Amodr-add-$this->id';" >
</form>

<form method="post" action="" id="Asale_stock_list">
<div class="search_admin">
		<font color=red><b>(查询标题或标签):</b></font>
		<input type="text" name="key" value="">
		<input type="submit" name="submit" value="搜索" onClick="javascript:form.action='';" />
		当前查询:<font color=red><b>$key</b></font>
<!--搜索 end-->


</div>
当前菜单:<!--{if $listp}--><a href="$this->Aactr-$listp->pid">$listp->name - $listp->aurl</a><!--{/if}-->
<table class="-table">
	<tr>
		<th><b><a href="$page->theurl-aorder-pid,$pages->neworder$pages->other">名称</a></b></th>
		<th><b><a href="$page->theurl-aorder-color,$pages->neworder$pages->other">颜色</a></b></th>
		<th><b><a href="$page->theurl-aorder-cost,$pages->neworder$pages->other">成本</a></b></th>
		<th><b><a href="$page->theurl-aorder-price,$pages->neworder$pages->other">价格</a></b></th>
		<th><b>利润</b></th>
		<th><b><a href="$page->theurl-aorder-num,$pages->neworder$pages->other">数量</a></b></th>
		<th><b>管理</b></th>
	</tr>
<!--{loop $list $key $val}-->
	<tr>
		<td>
			<input type="checkbox" class="checkbox" name="chk[]" value="$val[id]">
			$val[name]
		</td>
		<td><input type="text" name="save[{$key}][color]" value="$val[color]" size="10"></td>
		<td><input type="number" name="save[{$key}][cost]" value="$val[cost]" size="8"></td>
		<td><input type="number" name="save[{$key}][price]" value="$val[price]" size="8"></td>
		<td><!--{eval echo $val[price]-$val[cost];}--></td>
		<td><input type="number" name="save[{$key}][num]" value="$val[num]" size="5"></td>
		<td>
			<input type="submit" value="删除" onClick="javascript:if(confirm('确实要删除吗?')) form.action='$this->Amodr-del-$val[pid]';" />
		</td>
		<input type="hidden" name="save[{$key}][id]" size="1" value="$val[id]">
	</tr>
<!--{/loop}-->
	<tr>
		<td>合计</td>
		<td></td>
		<td>$total[total]</td>
		<td></td>
		<td></td>
		<td>$total[nums]</td>
		<td>
			<input type="submit" value="删除" onClick="javascript:if(confirm('确实要删除吗?')) form.action='$this->Amodr-del-$val[pid]';" />
		</td>
		<input type="hidden" name="save[{$key}][id]" size="1" value="$val[id]">
	</tr>
	<tr>
		<td colspan="10">
			<input type="button" onclick="javascript:checkall(0);" value="全选" >
			<input type="button" onclick="javascript:checkall(1);" value="反选">
			<input type="submit" id="chkall_del" disabled="disabled" value="删除选择" onClick="javascript:form.action='$this->Amodr-delall';" />
			<input type="submit" name="submit" value="全部保存" onClick="javascript:form.action='$this->Amodr-save';" />
		</td>
	</tr>
</table>

</form>
<!-- 分页 -->
$pages->html


<!--{Atemplate tpl/footer}-->